<?php

/**
 * Contact form base class.
 *
 * @method Contact getObject() Returns the current form's model object
 *
 * @package    seth
 * @subpackage form
 * @author     Fuz
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseContactForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'name'         => new sfWidgetFormInputText(),
      'surname'      => new sfWidgetFormInputText(),
      'phone1'       => new sfWidgetFormInputText(),
      'phone2'       => new sfWidgetFormInputText(),
      'mail1'        => new sfWidgetFormInputText(),
      'mail2'        => new sfWidgetFormInputText(),
      'address1'     => new sfWidgetFormInputText(),
      'address2'     => new sfWidgetFormInputText(),
      'organization' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'name'         => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'surname'      => new sfValidatorString(array('max_length' => 20)),
      'phone1'       => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'phone2'       => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'mail1'        => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'mail2'        => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'address1'     => new sfValidatorString(array('max_length' => 90, 'required' => false)),
      'address2'     => new sfValidatorString(array('max_length' => 90, 'required' => false)),
      'organization' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('contact[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Contact';
  }

}
